import iconInputIcon from '@/assets/images/icon_Input.jpg';
import iconOutputIcon from '@/assets/images/icon_Output.jpg';
import iconCodeIcon from '@/assets/images/icon_Code.jpg';
import iconLLMIcon from '@/assets/images/icon_LLM.png';
import iconConditionIcon from '@/assets/images/icon_Condition.jpg';
import discussionIcon from '@/assets/images/icon_discussion.jpeg';
import httpIcon from '@/assets/images/icon_http.png';
import intentIcon from '@/assets/images/icon_Intent.jpg';
import loopIcon from '@/assets/images/icon_Loop.jpg';
import variableMergeIcon from '@/assets/images/icon_VariableMerge.jpg';
import batchIcon from '@/assets/images/icon_Batch.jpg';
import databaseIcon from '@/assets/images/icon_Database.jpg';
import qaIcon from '@/assets/images/icon_qa.jpg';
import databaseInsertIcon from '@/assets/images/icon_DatabaseInsert.jpg';
import databaseUpdateIcon from '@/assets/images/icon_DatabaseUpdate.jpg';
import databaseSelectIcon from '@/assets/images/icon_DatabaseSelect.jpg';
import databaseDeleteIcon from '@/assets/images/icon_DatabaseDelete.jpg';
import assignmentIcon from '@/assets/images/icon_assignment.jpg';
import workflowIcon from '@/assets/images/icon_workflow.png';
import pluginIcon from '@/assets/images/icon_plugin.png';

// 节点组
export const DEFAULT_NODE_LIST = [
  {
    type: '',
    nodes: [
      {
        icon: iconLLMIcon,
        label: '大模型',
        type: 'aimodel',
      },
      {
        icon: workflowIcon,
        label: '工作流',
        type: 'flowcode',
      },
      {
        icon: pluginIcon,
        label: '插件',
        type: 'plugincode',
      }
    ]
  },
  {
    type: '业务逻辑',
    nodes: [
      {
        icon: iconCodeIcon,
        label: '代码',
        type: 'code',
      },
      {
        icon: iconConditionIcon,
        label: '选择器',
        type: 'selectorcode',
      },
      {
        icon: intentIcon,
        label: '意图识别',
        type: 'IntentionRecognition',
      },
      {
        icon: loopIcon,
        label: '循环',
        type: 'circulation',
      },
      {
        icon: batchIcon,
        label: '批处理',
        type: 'batchprocessing',
      },
      {
        icon: variableMergeIcon,
        label: '变量聚合',
        type: 'variableAggregation',
      },
    ]
  },
  {
    type: '输入&输出',
    nodes: [
      {
        icon: iconInputIcon,
        label: '输入',
        type: 'inputcode',
      },
      {
        icon: iconOutputIcon,
        label: '输出',
        type: 'outputcode',
      }
    ]
  },
  {
    type: '数据库',
    nodes: [
      {
        icon: databaseIcon,
        label: 'SQL自定义',
        type: 'customizeSQL',
      },
      {
        icon: databaseInsertIcon,
        label: '新增数据',
        type: 'insertdata',
      },
      {
        icon: databaseUpdateIcon,
        label: '更新数据',
        type: 'updatedata',
      },
      {
        icon: databaseSelectIcon,
        label: '查询数据',
        type: 'selectdata',
      },
      {
        icon: databaseDeleteIcon,
        label: '删除数据',
        type: 'deteledata',
      }
    ]
  },
  {
    type: '知识库&数据',
    nodes: [
      {
        icon: assignmentIcon,
        label: '知识库写入',
        type: 'knowledgeBaseWriting',
      },
      {
        icon: assignmentIcon,
        label: '知识库检索',
        type: 'knowledgeBaseRetrieval',
      },
      {
        icon: assignmentIcon,
        label: '长期记忆',
        type: 'creditPeriodMemory',
      },
      {
        icon: assignmentIcon,
        label: '变量赋值',
        type: 'variableAssignment',
      }
    ]
  },
  {
    type: '会话管理',
    nodes: [
      {
        icon: discussionIcon,
        label: '创建会话',
        type: 'createSession'
      },
      {
        icon: discussionIcon,
        label: '修改会话',
        type: 'updateSession'
      },
      {
        icon: discussionIcon,
        label: '删除会话',
        type: 'deleteSession'
      },
      {
        icon: discussionIcon,
        label: '查询会话列表',
        type: 'selectSession'
      }
    ]
  },
  {
    type: '会话历史',
    nodes: [
      {
        icon: discussionIcon,
        label: '查询会话历史',
        type: 'selectHistorySession',
      },
      {
        icon: discussionIcon,
        label: '清空会话历史',
        type: 'clearHistorySession',
      }
    ]
  },
  {
    type: '消息',
    nodes: [
      {
        icon: discussionIcon,
        label: '创建消息',
        type: 'createMessage',
      },
      {
        icon: discussionIcon,
        label: '修改消息',
        type: 'updateMessage',
      },
      {
        icon: discussionIcon,
        label: '删除消息',
        type: 'deleteMessage',
      },
      {
        icon: discussionIcon,
        label: '查询消息列表',
        type: 'selectMessage',
      }
    ]
  },
  {
    type: '组件',
    nodes: [
      {
        icon: httpIcon,
        label: 'HTTP请求',
        type: 'HTTPRequest',
      },
      {
        icon: qaIcon,
        label: '问答',
        type: 'questions',
      }
    ]
  },
]

const nodesList = {}

DEFAULT_NODE_LIST.forEach(item => {
  item.nodes.forEach(group=>{
    nodesList[group.type] = {
      name: group.label,
      icon: group.icon
    }
  })
})

export const DEFAULT_NODES = nodesList